package com.example.myapp.adapter;


import android.content.Context;

import androidx.annotation.NonNull;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;

import java.util.List;

public class MainVpAdapter extends FragmentStatePagerAdapter {
    Context context;
    List<Fragment> listFragment;

    public MainVpAdapter(@NonNull FragmentManager fm,Context context, List<Fragment> listFragment) {
        super(fm);
        this.context=context;
        this.listFragment=listFragment;
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
//        DemoFragment demoFragment=new DemoFragment();
//        return demoFragment;
        return listFragment.get(position);
    }

    @Override
    public int getCount() {
        return listFragment.size();
    }
}
